<template>
  <el-dialog
    :title="title"
    :close-on-click-modal="false"
    :visible.sync="visible"
    :before-close="cancel"
    class="JNPF-dialog JNPF-dialog_center"
    lock-scroll
    width="55%"
  >
    <el-row :gutter="15" class="">
      <el-form
        ref="elForm"
        :model="dataForm"
        :rules="rules"
        label-width="100px"
      >

      <el-col :span="12">
          <el-form-item label="所属学院">
            <el-select v-model="dataForm.FHOME" placeholder="请选择">
              <el-option
                v-for="item in options1"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>


      <el-col :span="12">
          <el-form-item label="学年届" class="required" prop="FYEAR">
            <el-input
              v-model="dataForm.FYEAR"
              placeholder="请输入"
              clearable
              :disabled="!insertorupdate"
              maxlength="8"
              :style="{ width: '100%' }"
            >
            </el-input>
          </el-form-item>
        </el-col>

       <el-col :span="12">
          <el-form-item label="所属年级">
            <el-select v-model="dataForm.FPARENTNO" placeholder="请选择">
              <el-option
                v-for="item in options1"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="所属班级">
            <el-select v-model="dataForm.FCLASS" placeholder="请选择">
              <el-option
                v-for="item in options3"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="学籍号" class="required" prop="FCATNO">
            <el-input
              v-model="dataForm.FCATNO"
              placeholder="请输入"
              clearable
              :disabled="!insertorupdate"
              maxlength="8"
              :style="{ width: '100%' }"
            >
            </el-input>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item class="required" label="学生姓名" prop="FCATNAME">
            <el-input
              v-model="dataForm.FCATNAME"
              placeholder="请输入"
              clearable
              :style="{ width: '100%' }"
            >
            </el-input>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="有效起日" prop="FBEGDATE" >
            <el-date-picker v-model="dataForm.FBEGDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>

        </el-form-item>

        </el-col>

        <el-col :span="12">
          <el-form-item label="有效讫日" prop="FENDDATE" >
            <el-date-picker v-model="dataForm.FENDDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>

        <el-col :span="12">
            <el-form-item label="开通状态">
              <el-select v-model="dataForm.FNOTE" placeholder="请选择" >
                <el-option
                  v-for="item in options4"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

      </el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
      <el-button  v-if="insertorupdate" type="primary" v-loading="loading">确 定</el-button>
      <el-button v-else type="primary"  v-loading="loading">修 改</el-button>
    </span>
  </el-dialog>
</template>
<script>
import jnpf from "@/utils/jnpf"
export default {
  props: {
    parelist: {
      type: Array,
      default: []
    },
  },
  data() {
    return {
        title:"新增",
        dataForm:{
            FHOME:"化学与材料科学学院",
            FYEAR: 2024,
            FPARENTNO: "大一",
            FCLASS:"化学系1班",
            FCATNO: "241003",
            FCATNAME: "关羽",
            FSEX: "男",
            FBEGDATE: "2024-12-01",
            FENDDATE: "2025-11-30",
            FNOTE:"已禁止",
            FOPERATOR: "system",
            FUPDDATE: "2011-02-16T02:57:02.000+00:00"
        },
        rules: {
          FCATNO: [
                { required: true, message: '请输入班级编号', trigger: 'blur' },
            ],
            FCATNAME: [
                { required: true, message: '请输入班级名称', trigger: 'blur' },
            ],
            FYEAR:[
                { required: true, message: '请输入学年届', trigger: 'blur' },
            ],
        },
        catlist:[
        {id:"10",fullName:"面食"},
        {id:"11",fullName:"零食"},
      ],
      fvisiblelist:[
        {id:"1",fullName:"是"},
        {id:"2",fullName:"否"},
      ],

      //所属校区选择数据
      options1: [{
        value: '1',
        label: '化学与材料科学学院'
      }, {
        value: '2',
        label: '生命科学学院'
      }],

      //所属校区选择数据
      options2: [{
        value: 'L001',
        label: '大一'
      }, {
        value: 'L002',
        label: '大二'
      }, {
        value: 'L003',
        label: '大三'
      }, {
        value: 'L004',
        label: '大四'
      }],

      //所属校区选择数据
      options3: [{
        value: 'L001',
        label: '化学系1班'
      }, {
        value: 'L002',
        label: '化学系2班'
      }],

      //所属场地选择数据
      options4: [{
          value: 'L001',
          label: '未开通'
        }, {
          value: 'L002',
          label: '已开通'
        }],

      
      loading:false,
      visible:false,
      insertorupdate:true
    };
  },
  created() {
  },
  mounted() {},
  methods: {
    //
    init(id){
      this.dataForm.FCATNO= id || ''
        if(this.dataForm.FCATNO)
        {
            this.title="修改"
           this.insertorupdate=false;
        }
        else
        {
          this.insertorupdate=true;
            this.title="新增";
        }
        this.visible=true;
    },
    //
    cancel(){
        this.$refs.elForm.resetFields();
        this.visible=false;
    },
  },
};
</script>




